/**
 * 
 */
package s2h.model;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * @author WIN7
 *
 */
@Entity
@Table(name="DEPARTMENTS")
public class DepartmentModel {
	
	private int iddepartment;
	private String departmentname;
	private List<UserModel> usermodel = new ArrayList<UserModel>();
	
	@Id
	@Column(name="ID_DEPARTMENT")
	public int getIddepartment() {
		return iddepartment;
	}
	public void setIddepartment(int iddepartment) {
		this.iddepartment = iddepartment;
	}
	@Column(name="DEPARTMENT_NAME")
	public String getDepartmentname() {
		return departmentname;
	}
	public void setDepartmentname(String departmentname) {
		this.departmentname = departmentname;
	}
//	@OneToMany(fetch = FetchType.LAZY,cascade = CascadeType.ALL)
	//@OneToMany(cascade = CascadeType.ALL)
    //@JoinTable(name = "USERS", joinColumns = { @JoinColumn(name = "ID_DEPARTMENT")})
	@OneToMany(cascade = CascadeType.ALL)
    @JoinTable(name = "USERS", joinColumns = { @JoinColumn(name = "DEPARTMENT")})
	public List<UserModel> getUsermodel() {
		return usermodel;
	}
	public void setUsermodel(List<UserModel> usermodel) {
		this.usermodel = usermodel;
	}
	

}
